
var app = getApp()
Page({
  data: {
    city: "北京市",
    hotcityList: []
  },
  onLoad: function () {
    this.setData({
      city: app.globalData.currentCity
    })
    this.loadData()
  },
  loadData() {
    var self = this
    app.request({
      url: '/home/hotel/citys',
      method: 'POST',
      success: (res) => {
        console.log(res)
        self.setData({
          hotcityList: res.result
        })
      }
    })
  },
  onShow: function () {
  },
  //选择城市
  bindHotCity: function (e) {
    this.setData({
      city: e.currentTarget.dataset.city
    })
    getApp().globalData.currentCity = this.data.city;
    // var pages = getCurrentPages();
    // if (pages.length > 1) {
    //   var beforePage = pages[pages.length - 2];//获取上一个页面实例对象
    //   beforePage.onLoad();
    // }
    wx.navigateBack({
      delta: 1
    })
  }
})